﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="CNTVNow.Web.Helpers.ExtensionMethods" %>
<%@ Import Namespace="CNTVNow.Web.Models" %>
<%@ Import Namespace="CNTVNow.Web.Helpers.Common" %>
<%@ Import Namespace="System.Collections.Generic" %>
<div class="box02">
    <ul class="news04">
        <%if (ViewData["NewsMiddle"] != null)
        {
            var lstNews = (List<New>)ViewData["NewsMiddle"];
            int index = 0;
            int lengthNews = lstNews.Count;

            while (index < lengthNews)
            {
                var news = lstNews[index];
            %>
                <li>
                    <div class="divblock">
                        <div class="top">
                            <h4><i>Posted <%=Common.GetPostedNews(news.LastModifiedDate.Value) %></i></h4>
                            <h2 class="style03"><a href="<%=Common.GetCategoryUrl(news.Category.CategoryID) %>"><%=news.Category.CategoryName %><%--<b></b>--%></a></h2>
                            <div class="info">
                                <div class="description">
                                    <h2 class="style02"><a href="Detail.cntv?n=<%=news.NewsID%>"><%=news.NewsTitle %></a></h2>
                                    <p><%=news.NewsDescription %> <a href="Detail.cntv?n=<%=news.NewsID%>"><%=Resources.Home.MoreAt + " " + news.Category.CategoryName%>  &raquo;</a></p>
                                </div>
                                <div class="image"><a href="Detail.cntv?n=<%=news.NewsID%>"><img src="<%=ResolveUrl(news.AvatarImage)%>" alt="" height="105" width="140" /></a></div>
                                <div class="clr"></div>
                            </div>
                            <div class="share">
                                <ul class="right">
                                    <li><a href="#"><%=Resources.Common.Share %></a></li>
                                    <li><a href="#" class="icon01 ico01 iconshow01"></a></li>
                                    <li><a href="#" class="icon01 ico02 iconshow01"></a></li>
                                    <li><a href="#" class="icon01 ico03 iconshow01"></a></li>
                                    <li><a href="#" class="icon01 ico04 iconshow01"></a></li>
                                    <li><a href="#" class="icon01 ico05 iconshow02"></a></li>
                                </ul>
                            </div>
                        </div>
                        <div class="bottom">
                            <% index ++;
                               if(index < lengthNews)
                               {
                                   if (news.NewsCategoryID == lstNews[index].NewsCategoryID)
                                   {
                                   %>
                                        <h4><%=Resources.Home.MoreIn + " " + news.Category.CategoryName%> 
                                        <a href="Detail.cntv?n=<%=news.NewsID%>"><%=lstNews[index].NewsTitle%></a></h4>
                               
                                <% index++;
                                   }
                               }
                               %>
                        </div>
                    </div>
                </li>
            <%
            }
        }
        %>
    </ul>
</div>